package com.egreen.system.service;

import com.egreen.common.serviceapi.user.IUserServiceApi;
import com.egreen.system.service.api.impl.VerificationCodeAPIIMPl;
import org.apache.dubbo.config.annotation.DubboReference;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;

/**
 * 测试验证码功能
 */
@SpringBootTest
public class getVerificationCodeTEST {
    @Autowired
    VerificationCodeAPIIMPl verificationCodeAPI;
    @DubboReference
    IUserServiceApi userServiceApi;

//    @Test
//    void addCode(){
//        int userId = 1;
//        String code = "zxc";
//        VerificationCodeDTO verificationCodeDTO = new VerificationCodeDTO();
//        verificationCodeDTO.setCode(code);
//        verificationCodeDTO.setUserId(userId);
//        verificationCodeAPI.addVerificationCode(verificationCodeDTO);
//    }


    @Test
    void sendTest(){
        String code = userServiceApi.sendValidCodeSms("19987234851");
        verificationCodeAPI.addVerificationCode(1L,code);
        System.out.println(verificationCodeAPI.getVerificationCode(1L));
    }

    @Test void getTest(){
        System.out.println(verificationCodeAPI.getVerificationCode(1L));
    }
}
